Detects the skew of images. The detection process focuses on the content of the image, such as text and drawings, rather than the borders. The most common causes of mis-detection are listed below. In all cases, Confidence will be a low value. In some cases, u.SC0.DetectedVariation will be low, in others it will be high. This operation works on all color depths supported by the opcode.
- Insufficient content. This operation will usually fail on blank pages, for example. u.SC0.DetectedVariation will be low in this case. In many cases, increasing DetectionQuality will allow the subcode to correctly detect the skew of these images.
- Multiple skews. An example of an image with multiple skews would be a photocopy of several small documents, each having a different skew. u.SC0.DetectedVariation will be high in this case.
- Curled and distorted images. These images are usually caused by paper feeding problems at scan time and are commonly produced by fax machines. This situation also frequently arises when images are scanned on a flatbed scanner and the paper is not flat (such as a book). u.SC0.DetectedVariation will be high in this case.
- Unusable content. This operation will usually fail on photographs, handwriting, or non-textual content. u.SC0.DetectedVariation will usually be low in this case.
The uncompressed image to be analyzed must reside in the Get Queue prior to REQ_EXEC. Typically, the image will be fully contained in the Get Queue, but that is not a requirement. This operation will not produce an output image.
- Subcode is set to SF_SUBCODE_DETECT_SKEW (0).
- DetectionQuality is set from 0 to 100, with 0 causing detection to run as fast as possible and 100 causing detection to be as careful and accurate as possible. 50 is a good default value.
- Stride is set to the image line width in bytes including padding at the end of the line width or to 0. If Stride is 0 and PF_NoDibPad is set in PicFlags, the operation will compute the stride using: [ (PixelWidth*BitCount)/8 ]. If Stride is 0 and PF_NoDibPad is not set in PicFlags, the operation will compute the stride using: [ (((PixelWidth*BitCount)+31)&(~31))/8 ].
This operation does not produce an output image. Instead, the output is stored back into the PIC_PARM structure in the following locations.
- Confidence is set, during REQ_EXEC, from 0 to 100 with 0 indicating that the detected skew angle is probably not correct and 100 indicating that the detected angle is almost certainly correct. Values above 70 usually indicate accurate results and values below 50 frequently indicate incorrect results. Depending on the needs of the application, this value can be used to recognize and redirect problem images before too much time is invested in them.
- u.SC0.DetectedHorizontalAngle is set, during REQ_EXEC, to the amount of rotation (in degrees counter-clockwise) needed to correct the skew of horizontal lines in the image. Generally, this will be identical to, or nearly identical to u.SC0.DetectedVerticalAngle. This value will always be in the range -20 to +20 inclusive.
- u.SC0.DetectedVerticalAngle is set, during REQ_EXEC, to the amount of rotation (in degrees counter-clockwise) needed to correct the skew of vertical lines in the image. Generally, this will be identical to, or nearly identical to u.SC0.DetectedHorizontalAngle. This value will always be in the range -20 to +20 inclusive.
- u.SC0.DetectedVariation is set, during REQ_EXEC, from 0 to 100 with 0 indicating that the detected skew was very uniform across the image and 100 indicating that the detected skew varied substantially from place to place on the image. The operation produces this value in order to assist in manual analysis of low confidence images. If the value is high, indicating that there may be no single correct skew, the operation will automatically reduce Confidence.